package com.ludomancy.hugealien;

import java.awt.Rectangle;

public class Game
{
	public static Game game;
	
	public static final int WORLD_WIDTH = 240;
	public static final int WORLD_HEIGHT = 232;

	public boolean paused = false;
	
	public Alien player;
	public City city;
	public SoulWorld soulWorld;
	public boolean isOver = false;
	
	public Game()
	{
		game = this;
		generateWorld();
	}
	
	private void generateWorld()
	{
		player = new Alien();
		player.x = 50;
		player.y = 50;
		city = City.generate();
		city.entities.add(player);
		soulWorld = SoulWorld.generate(city);
	}
	
	public boolean isEntityIn(Alien player)
	{
		Rectangle p = player.area();
		Rectangle world = new Rectangle(0,0,WORLD_WIDTH,WORLD_HEIGHT);
		return world.contains(p);
	}
	
	public void update()
	{
		if(paused)
		{
			return;
		}
		
		player.update();
		city.update();
	}
	
	public void setPaused(boolean paused)
	{
		this.paused  = paused;
	}

	public void endGame()
	{
		isOver = true;
	}
}
